import Vue from 'vue';
import Vuex, { Store } from 'vuex';
// import createPersistedState from 'vuex-persistedstate';
import { app } from './modules/app';
import { user } from './modules/user';

Vue.use(Vuex);

export const store = new Store({
  strict: process.env.NODE_ENV !== 'production',
  modules: {
    app,
    user,
  },
  plugins: [
    // createPersistedState({
    //   storage: window.sessionStorage,
    //   reducer(val) {
    //     return {
    //       app: val.app,
    //       stateManage: val.stateManage,
    //     };
    //   },
    // }),
  ],
});

const createStore = () => {
  return store;
};

export default createStore;
